<?php

namespace Yj\Generator\Core\Model\Traits;

trait AccessModifierTrait
{
    /**
     * @var String
     */
    protected $access;

    /**
     * @return String
     */
    public function getAccess(): string
    {
        return $this->access;
    }

    /**
     * @param String $access
     *
     * @return $this
     */
    public function setAccess(string $access)
    {
        if (!in_array($access, ['private', 'protected', 'public'])) {
            $access = 'public';
        }
        $this->access = $access;
        return $this;
    }
}